-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI tests for simd, distribution #6095
Conversation
…s-sdk into sahith/add-cli-test
…osmos-sdk into atheesh/cli-test-send
…esh/cli-test-send # Conflicts: # cli_test/tests/staking_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests failed again:
--- FAIL: TestValidateGenesis (0.00s)
gobash.go:60: Running simd --home=/tmp/sdk_integration_TestValidateGenesis_897338208/.simd unsafe-reset-all
gobash.go:72:
Error Trace: gobash.go:72
executors.go:22
executors.go:17
helpers.go:47
init.go:18
simd_test.go:118
Error: Received unexpected error:
exec: "simd": executable file not found in $PATH
Test: TestValidateGenesis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few suggestions. I'm also attaching a patch to fix the issue - I hope this helps:
commit a64ecea3c67c4fde234b092a29627279e2a4af41
Author: Alessio Treglia <alessio@tendermint.com>
Date: Fri May 1 01:45:01 2020 +0200
skip tests if builddir is empty
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 92ffad089..2621695fb 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -35,7 +35,7 @@ jobs:
if: "env.GIT_DIFF != ''"
- name: test & coverage report creation
run: |
- go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock cli_test'
+ go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock cli_test' -builddir=./build/
if: "env.GIT_DIFF != ''"
- name: filter out DONTCOVER
run: |
diff --git a/Makefile b/Makefile
index 0e0876afb..7bdb9ae0f 100644
--- a/Makefile
+++ b/Makefile
@@ -169,8 +169,8 @@ test-sim-benchmark-invariants:
-Period=1 -Commit=true -Seed=57 -v -timeout 24h
cli-test: build-sim
- @go test -mod=readonly -p 4 `go list ./tests/cli/...` -tags=cli_test -v
- @go test -mod=readonly -p 4 `go list ./x/.../client/cli_test/...` -tags=cli_test -v
+ go test -mod=readonly -p 4 `go list ./tests/cli/...` -tags=cli_test -v -builddir=$(BUILDDIR)
+ go test -mod=readonly -p 4 `go list ./x/.../client/cli_test/...` -tags=cli_test -v -builddir=$(BUILDDIR)
.PHONY: \
test-sim-nondeterminism \
diff --git a/tests/cli/fixtures.go b/tests/cli/fixtures.go
index 5df955a72..4fb8e74f6 100644
--- a/tests/cli/fixtures.go
+++ b/tests/cli/fixtures.go
@@ -1,8 +1,8 @@
package cli
import (
+ "flag"
"io/ioutil"
- "os"
"path/filepath"
"testing"
@@ -16,7 +16,10 @@ import (
"github.com/cosmos/cosmos-sdk/simapp"
)
-var cdc = std.MakeCodec(simapp.ModuleBasics)
+var (
+ cdc = std.MakeCodec(simapp.ModuleBasics)
+ buildDir = flag.String("builddir", "", "Build directory")
+)
// Fixtures is used to setup the testing environment
type Fixtures struct {
@@ -45,15 +48,16 @@ func NewFixtures(t *testing.T) *Fixtures {
p2pAddr, _, err := server.FreeTCPAddr()
require.NoError(t, err)
- buildDir := os.Getenv("BUILDDIR")
- require.NotNil(t, buildDir)
+ if *buildDir == "" {
+ t.Skip("builddir is empty, skipping")
+ }
return &Fixtures{
T: t,
- BuildDir: buildDir,
+ BuildDir: *buildDir,
RootDir: tmpDir,
- SimdBinary: filepath.Join(buildDir, "simd"),
- SimcliBinary: filepath.Join(buildDir, "simcli"),
+ SimdBinary: filepath.Join(*buildDir, "simd"),
+ SimcliBinary: filepath.Join(*buildDir, "simcli"),
SimdHome: filepath.Join(tmpDir, ".simd"),
SimcliHome: filepath.Join(tmpDir, ".simcli"),
RPCAddr: servAddr,
.github/workflows/test.yml
Outdated
- name: test & coverage report creation | ||
run: | | ||
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' | ||
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock cli_test' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock cli_test' | |
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock cli_test' -builddir=`pwd`/build |
right extension for the HOST platform rename cli-test to test-integration
Codecov Report
@@ Coverage Diff @@
## master #6095 +/- ##
=======================================
Coverage 54.63% 54.63%
=======================================
Files 443 443
Lines 26666 26666
=======================================
Hits 14568 14568
Misses 11101 11101
Partials 997 997 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go
Reference - #5951
Description
This PR adds tests for simd cli commands and distribution commands
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)